package com.myidis.mapper;

import com.myidis.entity.AnalysisIndex;
import com.myidis.entity.IndexCombination;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IndexCombinationMapper {
    @Select("SELECT * FROM index_combination;")
    @Results({
            @Result(property = "name", column = "指标组合名称"),
            @Result(property = "creator", column = "创建人"),
            @Result(property = "creatTime", column = "创建时间"),
            @Result(property = "lastChange", column = "最后修改时间"),
            @Result(property = "remarks", column = "备注"),
            @Result(property = "benchmarkValue", column = "基准指标"),
    })
    List<IndexCombination> all();

    @Insert("INSERT intO index_combination(指标组合名称, 创建人, 创建时间, 最后修改时间, 备注, 基准指标)"
            + " VALUES (#{name}, #{creator}, #{creatTime}, #{lastChange}, #{remarks}, #{benchmarkValue});")
    int insert(IndexCombination add);

    @Update("UPDATE index_combination SET  最后修改时间 = #{lastChange}, "
            + "备注 = #{remarks} WHERE 指标组合名称 = #{name};")
    int update(IndexCombination add);

    @Delete("DELETE FROM index_combination WHERE 指标组合名称 = #{name};")
    int delete(@Param("name")String name);
}
